package com.woniuxy.store.app.apiImpl;

import com.woniuxy.orderService.client.OrderQueryClient;
import com.woniuxy.orderService.client.param.RoleStoreQueryMonthSaleParam;
import com.woniuxy.orderService.client.result.MonthSalesReportDto;
import com.woniuxy.store.app.util.StoreIdUtil;
import com.woniuxy.store.client.RoleStoreQuerySaleMonthClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import result.Result;

@RestController
@RequestMapping("/store/analyze")
public class RoleStoreQuerySaleMonthClientImpl implements RoleStoreQuerySaleMonthClient {
    @Autowired
    private OrderQueryClient orderQueryClient;
    @Override
    public Result queryStoreSaleMonth(String reportDay) {
        RoleStoreQueryMonthSaleParam roleStoreQueryMonthSaleParam = new RoleStoreQueryMonthSaleParam();
        roleStoreQueryMonthSaleParam.setStoreId(StoreIdUtil.getFromToken());
        roleStoreQueryMonthSaleParam.setReportDay(reportDay);
        Result<MonthSalesReportDto> monthSalesReportDtoResult = orderQueryClient.roleStoreQueryMonthSale(roleStoreQueryMonthSaleParam);

        return monthSalesReportDtoResult;
    }
}
